<?php
class ControllerPaymentbaokim extends Controller {
	protected function index() {
		$this->data['button_confirm'] = $this->language->get('button_confirm');
		$this->data['button_back'] = $this->language->get('button_back');
		$this->load->model('checkout/order');
		$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
		$this->load->library('encryption');
		
		$order_id = $this->session->data['order_id'];
		
		$total_amount=$this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false);
		$total_amount = intval($total_amount);
		$shipping_fee = '';
		$tax_fee = '';
		$order_description = '';
		$url_success = '';
		$url_cancel = '';
		$url_detail = '';
		$merchant_id = $this->config->get('baokim_merchant');
		$secure_pass = $this->config->get('baokim_security');
		$business = $this->config->get('baokim_business');
		
		//$this->data['continue'] = HTTPS_SERVER .'checkout_bk.php?merchant_id=123&total_amount=456';
        $this->data['continue'] = HTTPS_SERVER . 'checkout_bk.php?email='.$business.'&total_amount='.$total_amount.'&order_id='.$order_id.'&merchant_id='.$merchant_id.'&secure_pass='.$secure_pass.'&url_success='.$url_success;
		//echo $this->data['continue'];
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/baokim.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/payment/baokim.tpl';
		} else {
			$this->template = 'default/template/payment/baokim.tpl';
		}		
		
		$this->render();
		
	}
	
	
	public function confirm() {
			$this->load->model('checkout/order');
			
			$this->model_checkout_order->confirm($this->session->data['order_id'], $this->config->get('baokim_order_status_id'));
	}
}
?>